<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function sayName(name) {
            name = (typeof name !== 'undefined') ? name : 'XiaoSong'
            return name
        }
        console.log(sayName()) // XiaoSong
        console.log(sayName('js')) // js

        function sayName1(name = 'XiaoSong') {
            return name
        }
        console.log(sayName1()) // XiaoSong
        console.log(sayName1('js')) // js

        const refer = () => {
            console.log(name)
            let name = 'XiaoSong'
        }
        refer()
    </script>
</body>

</html>